package com.muyu.user.domain.model;

import java.math.BigDecimal;

import com.muyu.user.domain.req.SysUserLevelSaveReq;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
import lombok.experimental.SuperBuilder;

/**
 * 用户等级保存请求对象
 *
 * @author liuguoqiang
 * @date 2025-09-14
 */
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@Schema(description = "用户等级保存请求对象")
public class SysUserLevelSaveModel{

    /**
     * 主键标识
     */
    private Long levelId;
    /**
     * 等级名称
     */
    @Schema(name = "levelName", title = "等级名称", description = "等级名称" , required = true)
    private String levelName;

    /**
     * 等级编码
     */
    @Schema(name = "levelCode", title = "等级编码", description = "等级编码" , required = true)
    private String levelCode;

    /**
     * 等级图标
     */
    @Schema(name = "levelIcon", title = "等级图标", description = "等级图标" )
    private String levelIcon;

    /**
     * 折扣率
     */
    @Schema(name = "discountRate", title = "折扣率", description = "折扣率" )
    private BigDecimal discountRate;

    /**
     * 解锁经验值
     */
    @Schema(name = "unlockExperience", title = "解锁经验值", description = "解锁经验值" )
    private Long unlockExperience;

    /**
     * 等级描述
     */
    @Schema(name = "description", title = "等级描述", description = "等级描述" )
    private String description;

    /**
     * 排序
     */
    @Schema(name = "sortOrder", title = "排序", description = "排序" )
    private Long sortOrder;

    /**
     * 状态（0正常 1停用）
     */
    @Schema(name = "status", title = "状态（0正常 1停用）", description = "状态（0正常 1停用）" )
    private String status;


    /**
     * 修改构造器
     */
    public static SysUserLevelSaveModel saveReqBuild(SysUserLevelSaveReq saveReq){
        return SysUserLevelSaveModel.builder()
            .levelId(saveReq.getLevelId())
            .levelName(saveReq.getLevelName())
            .levelIcon(saveReq.getLevelIcon())
                .levelCode(saveReq.getLevelCode())
            .discountRate(saveReq.getDiscountRate())
            .unlockExperience(saveReq.getUnlockExperience())
            .description(saveReq.getDescription())
            .sortOrder(saveReq.getSortOrder())
            .status(saveReq.getStatus())
            .build();
    }

}
